<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Strict//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>

<link rel="stylesheet" href="../lib/layui/css/layui.css" type="text/css" />
<script src="../lib/layui/layui.js"></script>
<script src="../js/jquery/jquery-1.8.2.js"></script>
<title>在此插入标题</title>
</head>
<body>
	    
		<div class="layui-layout layui-layout-admin">
<div id="nav"></div>

		<div class="layui-body">
			<!-- 内容主体区域 -->


				<form class="layui-form" style="width: 300px  ">
		<!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
		<div class="layui-form-item">
			<label class="layui-form-label">名称</label>
			<div class="layui-input-block">
				<input type="text" name="name" placeholder="请输入名称"
					autocomplete="off" class="layui-input"  id="name">
			</div>
		</div>
		<div class="layui-form-item">  
			<label class="layui-form-label">部门</label>
			<div class="layui-input-block">
				<input type="text" name="nicheng" placeholder="请输入所属部门"
					autocomplete="off" class="layui-input">
			</div>
		</div>
  		<div class="layui-form-item">  
			<label class="layui-form-label">电话</label>
			<div class="layui-input-block">
				<input type="text" name="phone" placeholder="请输入电话"
					autocomplete="off" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">  
			<label class="layui-form-label">档案信息</label>
			<div class="layui-input-block">
				<input type="text" name="dangAn" placeholder="请输入档案信息"
					autocomplete="off" class="layui-input">
			</div>
		</div>

		

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit lay-filter="sub">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
		<!-- 更多表单结构排版请移步文档左侧【页面元素-表单】一项阅览 -->
	</form>

  




			<table id="demo" lay-filter="test"></table>
		</div>



	<div class="layui-footer">
			<!-- 底部固定区域 -->
		//底部放置位置
		</div>
	</div>
				

	<script>
	$("#nav").load("H.html");
		layui.use([ 'form', 'table', 'upload', 'layer', 'element' ],
						function() {   
  
							var form = layui.form;
							var upload = layui.upload;
							var layer = layui.layer;
							var element = layui.element;
							var table = layui.table;
							var $ = layui.$;

							
							//提交按钮
							form.on('submit(sub)', function(data) {
								console.log(data.field) //被执行事件的元素DOM对象，一般为button对象
								data.field.img = $("#imgl").html();
								$.ajax({
									url : "../GuWenjServlet",
									type : "get",
									data : data.field,
									success : function(res) {
										alert(res.msg);
									}
 
			 					});
								return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
							});

							//各种基于事件的操作，下面会有进一步介绍

							var $ = layui.$;


								//执行实例  
								//图片链接
								var uploadInst = upload.render({
									elem : '#test1' //绑定元素
									,
									url : '../upload' //上传接口
									,
									done : function(res) {
										//上传完毕回调
										console.log(res);
										if (res.code == 0) {
  
											$("#imgl").html(res.data);
										}
									},
									error : function() {
										//请求异常回调

										console.log(res);
									}
								}); 
  
							
							
							//动态下拉框  
							
						});
	</script>
</body>
</html>